package uns.fit.gis.contextmenu;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Displayable;

import uns.fit.gis.MapDrawer;
import uns.fit.gis.i18n.LocaleManager;
import uns.fit.gis.mapdrawer.ActionCode;

public class GPSContextMenu extends ContextMenu {
	public GPSContextMenu() {
		commands = new Command[5];
		commands[0] = new Command(LocaleManager.getMessage("menu"), Command.ITEM, 1);
		commands[1] = new Command(LocaleManager.getMessage("stopgps"), Command.ITEM, 1);
		commands[2] = new Command(LocaleManager.getMessage("showsky"), Command.ITEM, 1);
		commands[3] = new Command(LocaleManager.getMessage("showsatellites"), Command.ITEM, 1);
		commands[4] = new Command(LocaleManager.getMessage("exit"), Command.EXIT, 1);
	}
	public void commandAction(Command command, Displayable displayable) {
		if(command == commands[0]) {
			MapDrawer.getMidlet().mapCanvas.commandAction(ActionCode.SHOW_MENU);
		}
		if(command == commands[1]) {
			MapDrawer.getMidlet().mapCanvas.commandAction(ActionCode.RUN_GPS);
		}
		else if(command == commands[2]) {
			MapDrawer.getMidlet().showSkyCanvas();
		}
		else if(command == commands[3]) {
			MapDrawer.getMidlet().showSatelliteCanvas();
		}
		else if(command == commands[4]) {
			MapDrawer.getMidlet().mapCanvas.commandAction(ActionCode.DESTROY_APP);
		}
	}

}
